﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;

namespace Kooboo.HtmlFunc.Exceptions
{
    public class FuncCommentNodeException : BaseException
    {
        public FuncCommentNodeException(string fileName, HtmlCommentNode node)
            : base()
        {
            this.ExceptionNode = node;
            this.ExceptionFile = fileName;
        }

        public override string Message
        {
            get
            {
                var builder = new StringBuilder();
                builder.AppendFormat("Exception File: {0}.", this.ExceptionFile).AppendLine();
                builder.AppendFormat("Exception Line: {0}.", this.ExceptionLine).AppendLine();
                builder.AppendFormat("Exception Line Position: {0}.", this.ExceptionLinePosition).AppendLine();
                builder.AppendFormat("Exception Description: {0}", this.ExceptionDescription).AppendLine();
                return builder.ToString();
            }
        }

        public string ExceptionFile
        {
            get;
            private set;
        }

        public HtmlCommentNode ExceptionNode
        {
            get;
            private set;
        }

        public int ExceptionLine
        {
            get
            {
                return this.ExceptionNode.Line;
            }
        }

        public int ExceptionLinePosition
        {
            get
            {
                return this.ExceptionNode.LinePosition;
            }
        }

        public virtual string ExceptionDescription
        {
            get;
            private set;
        }
    }
}
